package me.liquidifica.agil.service.general;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;

public class GeneralService implements HelloWorldManager {

	public String showHelloWorld(String name) {
		
		Client client = Client.create();
		 
		WebResource webResource = client
		   .resource("http://localhost:8080/agil-service/helloWorld/" + name);
 
		ClientResponse response = webResource.accept("application/json").get(ClientResponse.class);
 
		if (response.getStatus() != 200) {
		   throw new RuntimeException("Failed : HTTP error code : "
			+ response.getStatus());
		}
 
		return response.getEntity(String.class);
 
	}

}
